package v1

import (
	"auth/bll"
	"auth/model"
	"auth/utils"
	"github.com/gin-gonic/gin"
)

var Captcha = &captcha{}

type captcha struct{}

func (c *captcha) Init(r *gin.RouterGroup) {
	g := r.Group("/base")
	{
		g.POST("/captcha", c.create)
	}
}

func (t *captcha) create(c *gin.Context) {
	var (
		out *model.CaptchaResponse
		err error
	)
	if out, err = bll.Captcha.Create(c.Request.Context()); err != nil {
		c.Error(err)
		return
	}
	utils.ResponseOK(c, out)
}
